]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Add API to animate launch at given position
authorJonas Dreßler <verdre@v0yd.nl>
Sun, 15 Sep 2019 09:40:27 +0000 (11:40 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Wed, 18 Sep 2019 17:14:16 +0000 (17:14 +0000)
Add a `animateLaunchAtPos()` method to the AppIcon class to animate the
launch of an app at a given position. This allows for a visual
indication of whether dropping an app icon using DnD was successful at
the position the drop happened in a later commit.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/121

js/ui/appDisplay.js
js/ui/iconGrid.js

index 9b61d4e26fb22b06089751bfee4556fdd23b200c..8571d86b908cf3f4ffa5882acd170d486ef6f9be 100644 (file)
@@ -2208,6 +2208,10 @@ var AppIcon = class AppIcon {
         this.icon.animateZoomOut();
     }
 
+    animateLaunchAtPos(x, y) {
+        this.icon.animateZoomOutAtPos(x, y);
+    }
+
     scaleIn() {
         this.actor.scale_x = 0;
         this.actor.scale_y = 0;
index ca23bccdb88c664737173fbb3855e1daf62e6c19..ffddd11bdfa91f489cf39043ae66dd8e53142004 100644 (file)
@@ -142,6 +142,10 @@ class BaseIcon extends St.Bin {
         zoomOutActor(this.child);
     }
 
+    animateZoomOutAtPos(x, y) {
+        zoomOutActorAtPos(this.child, x, y);
+    }
+
     update() {
         this._createIconTexture(this.iconSize);
     }
@@ -152,10 +156,15 @@ function clamp(value, min, max) {
 }
 
 function zoomOutActor(actor) {
+    let [x, y] = actor.get_transformed_position();
+    zoomOutActorAtPos(actor, x, y);
+}
+
+function zoomOutActorAtPos(actor, x, y) {
     let actorClone = new Clutter.Clone({ source: actor,
                                          reactive: false });
     let [width, height] = actor.get_transformed_size();
-    let [x, y] = actor.get_transformed_position();
+
     actorClone.set_size(width, height);
     actorClone.set_position(x, y);
     actorClone.opacity = 255;